package com.example.quiz.controller;

import com.example.quiz.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class HomeController {

    @Autowired
    private QuestionService questionService;

    @GetMapping("/")
    public String home(Model model) {
        // 获取题目总数
        int totalQuestions = questionService.getTotalCount(null, null);
        model.addAttribute("totalQuestions", totalQuestions);
        return "index";
    }
}
